//点击关闭按钮
function yin() {
    $("#WX").hide();
    $("#ZF").hide();
    $("#ZFQD").hide();
    $("#UNION").hide();
    $("#QDNS").hide();
    $("#ICBC").hide();
    $("#ShouQianBa").hide();
    $("#ccbb").hide();
    $("#kancloud").hide();
    $("#leshua").hide();
    $("#chinaums").hide();
    $("#unionschool").hide();
    $("#FuHuiBa").hide();
    $("#ksrcb").hide();
    $("#SuiXingPay").hide();
    $("#abc").hide();
    $("#qsf").hide();
    $("#ShengCan").hide();
    $("#POSTong").hide();
    $("#aggregation").hide();
    $("#DC").hide();
    $("#SCANPAY").hide();
    $("#UNIONPAYPS").hide();
    $("#HuiYinTong").hide();
    $("#bocom").hide();
    $("#SandHippo").hide();
    $("#laKaLa").hide();
    $("#psbc").hide();
    $("#saobei").hide();
    $("#haike").hide();
    $("#fuyou").hide();
    $("#longzhimeng").hide();
    $("#alischool").hide();
    $("#zhongshantong").hide();
    $("#zhaohangyiwangtong").hide();
    $("#quzhouyimafu").hide();
    $("#jianhangshenghuo").hide();
    $("#ccbpay").hide();
    $("#yinsheng").hide();
    $("#nonghangjf").hide();
    $("#lanzhou").hide();
    removeAttr();
    rmLine();
    $("#payChannel").removeAttr("name");
    $("#payChannel").removeAttr("required");
    $("#type").removeAttr("name");
    $("#type").removeAttr("required");
}



//获取下拉框选中的值，选择显示选中的支付渠道
$("#type").change(function(){
    //要触发的事件
    //移除input 标签中的属性
    var all="";
    $("#WX").hide();
    $("#ZF").hide();
    $("#UNION").hide();
    $("#QDNS").hide();
    $("#ICBC").hide();
    $("#ShouQianBa").hide();
    $("#ccbb").hide();
    $("#kancloud").hide();
    $("#leshua").hide();
    $("#chinaums").hide();
    $("#unionschool").hide();
    $("#FuHuiBa").hide();
    $("#ksrcb").hide();
    $("#SuiXingPay").hide();
    $("#abc").hide();
    $("#aggregation").hide();
    $("#DC").hide();
    $("#SCANPAY").hide();
    $("#HuiYinTong").hide();
    $("#bocom").hide();
    $("#SandHippo").hide();
    $("#laKaLa").hide();
    $("#psbc").hide();
    $("#saobei").hide();
    $("#haike").hide();
    $("#fuyou").hide();
    $("#longzhimeng").hide();
    $("#alischool").hide();
    $("#zhongshantong").hide();
    $("#zhaohangyiwangtong").hide();
    $("#quzhouyimafu").hide();
    $("#jianhangshenghuo").hide();
    $("#ccbpay").hide();
    $("#yinsheng").hide();
    $("#nonghangjf").hide();
    $("#lanzhou").hide();
    removeAttr();
    var reslist=$("#type").select2("data");
    var strPayChannel="000000000000000000000000000000";
    for(var i=0;i<reslist.length;i++){
        all=reslist[i].text;
        if (all=="支付宝"){
            zhifubao(i);
            strPayChannel=replaceChat(strPayChannel,1,1);
            $("#ZF").show();
        }else if (all=="微信") {
            weixin(i);
            $("#paytype1").trigger("change");
            strPayChannel=replaceChat(strPayChannel,0,1);
            $("#WX").show();
        }else if (all=="工行聚合支付") {
            icbc(i);
            strPayChannel=replaceChat(strPayChannel,2,1);
            $("#ICBC").show();
        }else if (all=="银联支付") {
            union(i);
            $("#unionpaytype").trigger("change");
            strPayChannel=replaceChat(strPayChannel,3,1);
            $("#UNION").show();
        }else if (all=="青岛农商") {
            qingdaonongshang(i);
            strPayChannel=replaceChat(strPayChannel,4,1);
            $("#QDNS").show();
        }else if (all=="收钱吧") {
            shouqianba(i);
            strPayChannel=replaceChat(strPayChannel,5,1);
            $("#ShouQianBa").show();
        }else if (all=="龙支付") {
            ccbbs(i);
            strPayChannel=replaceChat(strPayChannel,6,1);
            $("#ccbb").show();
        }else if (all=="移领支付") {
            kanclouds(i);
            strPayChannel=replaceChat(strPayChannel,7,1);
            $("#kancloud").show();
        }else if (all=="乐刷") {
            leshua(i);
            strPayChannel=replaceChat(strPayChannel,8,1);
            $("#leshua").show();
        }else if (all=="大华捷通") {
            chinaums(i);
            $("#chinaumsType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,9,1);
            $("#chinaums").show();
        }else if (all=="银联支付校园版") {
            unionschool(i);
            $("#unionschoolType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,10,1);
            $("#unionschool").show();
        }else if (all=="付惠吧") {
            FuHuiBa(i);
            strPayChannel=replaceChat(strPayChannel,11,1);
            $("#FuHuiBa").show();
        }else if (all=="江苏昆山农商银行") {
            ksrcb(i);
            strPayChannel=replaceChat(strPayChannel,12,1);
            $("#ksrcb").show();
        }else if (all=="随行付") {
            SuiXingPay(i);
            $("#SuiXingPaytype").trigger("change");
            strPayChannel=replaceChat(strPayChannel,13,1);
            $("#SuiXingPay").show();
        }else if (all=="中国农行") {
            abc(i);
            strPayChannel=replaceChat(strPayChannel,14,1);
            $("#abc").show();
            $("#abcBu").val("404")
        }else if (all=="轻松付") {
            qsf(i);
            $("#qsftype").trigger("change");
            strPayChannel=replaceChat(strPayChannel,15,1);
            $("#qsf").show();
        }else if (all=="智慧校园盛灿") {
            ShengCan(i);
            $("#ShengCantype").trigger("change");
            strPayChannel=replaceChat(strPayChannel,16,1);
            $("#ShengCan").show();
        }else if (all=="POS通") {
            POSTong(i);
            $("#POSTongtype").trigger("change");
            strPayChannel=replaceChat(strPayChannel,17,1);
            $("#POSTong").show();
        }else if (all=="汇银通POS") {
            HuiYinTong(i);
            $("#huiYinTongType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,18,1);
            $("#HuiYinTong").show();
        }else if (all=="交通银行") {
            bocom(i);
            $("#bocomType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,19,1);
            $("#bocom").show();
        }else if (all=="杉德河马付") {
            SandHippo(i);
            $("#SandHippoType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,20,1);
            $("#SandHippo").show();
        }else if (all=="拉卡拉") {
            laKaLa(i);
            $("#laKaLaType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,21,1);
            $("#laKaLa").show();
        }else if (all=="邮政") {
            psbc(i);
            $("#psbcType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,22,1);
            $("#psbc").show();
        }else if (all=="扫呗") {
            saobei(i);
            $("#saobeiType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,23,1);
            $("#saobei").show();
        }else if (all=="嗨客") {
            haike(i);
            $("#haikeType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,24,1);
            $("#haike").show();
        }else if (all=="富友") {
            fuyou(i);
            $("#fuyouType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,25,1);
            $("#fuyou").show();
        }else if (all=="进钱吧") {
            longzhimeng(i);
            $("#longzhimengType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,26,1);
            $("#longzhimeng").show();
        }else if (all=="支付宝中小学一脸通") {
            alischool(i);
            $("#alischoolType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,27,1);
            $("#alischool").show();
        }else if (all=="中山通") {
            zhongshantong(i);
            $("#zhongshantongType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,28,1);
            $("#zhongshantong").show();
        }else if (all=="招行一网通") {
            zhaohangyiwangtong(i);
            $("#zhaohangyiwangtongType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,29,1);
            $("#zhaohangyiwangtong").show();
        }else if (all=="衢州一码付") {
            quzhouyimafu(i);
            $("#quzhouyimafuType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,30,1);
            $("#quzhouyimafu").show();
        }else if (all=="建行生活") {
            jianhangshenghuo(i);
            $("#jianhangshenghuoType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,31,1);
            $("#jianhangshenghuo").show();
        }else if(all == "中信银行"){
            console.log("中信银行")
             ccbpay(i);
            $("#ccbpayType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,33,1);
            $("#ccbpay").show();
        }else if(all == "银盛"){
              yinsheng(i);
               strPayChannel="0000000000000000000000000000000000";
             $("#yinshengType").trigger("change");
             strPayChannel=replaceChat(strPayChannel,33,1);
             $("#yinsheng").show();
         }else if(all == "兰州银行"){
            lanzhou(i);
            strPayChannel="0000000000000000000000000000000000000";
            $("#lanzhouType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,36,1);
            $("#lanzhou").show();
        }else if(all == "农行缴费"){
            nonghangjf(i);
            strPayChannel="00000000000000000000000000000000000000";
            $("#nonghangjfType").trigger("change");
            strPayChannel=replaceChat(strPayChannel,37,1);
            $("#nonghangjf").show();
        }


    }
    $("#payChannel").val(strPayChannel);
});



function edityin() {
    $("#editWX").hide();
    $("#editZF").hide();
    $("#editZFQD").hide();
    $("#editICBC").hide();
    $("#editShouQianBa").hide();
    $("#editUNION").hide();
    $("#editQDNS").hide();
    $("#editccbb").hide();
    $("#editkancloud").hide();
    $("#editleshua").hide();
    $("#editchinaums").hide();
    $("#editunionschool").hide();
    $("#editFuHuiBa").hide();
    $("#editabc").hide();
    $("#editqsf").hide();
    $("#editHuiYinTong").hide();
    $("#editbocom").hide();
    $("#editlaKaLa").hide();

    $("#editaggregation").hide();
    $("#editDC").hide();
    $("#editUNIONPAYPS").hide();
    $("#editSCANPAY").hide();
    $("#editsaobei").hide();
    $("#edithaike").hide();
    $("#editpsbc").hide();
    $("#editfuyou").hide();
    $("#editlongzhimeng").hide();
    $("#editalischool").hide();
    $("#editzhongshantong").hide();
    $("#editzhaohangyiwangtong").hide();
    $("#editquzhouyimafu").hide();
    $("#editjianhangshenghuo").hide();
    $("#editccbpay").hide();
    $("#edityinsheng").hide();
    $("#editnonghangjf").hide();
    $("#editlanzhou").hide();
    editremoveAttr();

    //清空文本框
    editweixinclear();
    editzhifubaoclear();
}

$("#edittype").change(function(){
    //要触发的事件
    //移除input 标签中的属性
    var all="";
    $("#editWX").hide();
    $("#editZF").hide();
    $("#editUNION").hide();
    $("#editQDNS").hide();
    $("#editICBC").hide();
    $("#editShouQianBa").hide();
    $("#editkancloud").hide();
    $("#editccbb").hide();
    $("#editleshua").hide();
    $("#editchinaums").hide();
    $("#editunionschool").hide();
    $("#editFuHuiBa").hide();
    $("#editHuiYinTong").hide();
    $("#editbocom").hide();
    $("#editlaKaLa").hide();
    $("#editpsbc").hide();
    $("#editsaobei").hide();
    $("#edithaike").hide();
    $("#editabc").hide();
    $("#editfuyou").hide();
    $("#editlongzhimeng").hide();
    $("#editalischool").hide();
    $("#editzhongshantong").hide();
    $("#editzhaohangyiwangtong").hide();
    $("#editquzhouyimafu").hide();
    $("#editjianhangshenghuo").hide();
    $("#edityinsheng").hide();
    $("#editnonghangjf").hide();
    $("#editlanzhou").hide();


    editremoveAttr();
    var reslist=$("#edittype").select2("data");
    var strPaytype="000000000000000000000000000000";
    for(var i=0;i<reslist.length;i++){
        all=reslist[i].text;
        if (all=="支付宝") {
            editzhifubao(i);
            strPaytype=replaceChat(strPaytype,1,1);
            $("#editZF").show();
        }else if (all=="微信") {
            editweixin(i);
            $("#editpaytype1").trigger("change");
            strPaytype=replaceChat(strPaytype,0,1);
            $("#editWX").show();
        }else if (all=="工行聚合支付") {
            editicbc(i);
            strPaytype=replaceChat(strPaytype,2,1);
            $("#editICBC").show();
        }else if (all=="银联支付") {
            editunion(i);
            $("#editunionpaytype").trigger("change");
            strPaytype=replaceChat(strPaytype,3,1);
            $("#editUNION").show();
        }else if (all=="青岛农商") {
            editQDNS(i);
            strPaytype=replaceChat(strPaytype,4,1);
            $("#editQDNS").show();
        }else if (all=="收钱吧") {
            editShouQianBa(i);
            strPaytype=replaceChat(strPaytype,5,1);
            $("#editShouQianBa").show();
        }else if (all=="龙支付") {
            editccbb(i);
            strPaytype=replaceChat(strPaytype,6,1);
            $("#editccbb").show();
        }else if (all=="移领支付") {
            editkanclouds(i);
            strPaytype=replaceChat(strPaytype,7,1);
            $("#editkancloud").show();
        }else if (all=="乐刷") {
            editleshua(i);
            strPaytype=replaceChat(strPaytype,8,1);
            $("#editleshua").show();
        }else if (all=="大华捷通") {
            editchinaums(i);
            $("#editchinaumsType").trigger("change");
            strPaytype=replaceChat(strPaytype,9,1);
            $("#editchinaums").show();
        }else if (all=="银联支付校园版") {
            editunionschool(i);
            $("#editunionschoolType").trigger("change");
            strPaytype=replaceChat(strPaytype,10,1);
            $("#editunionschool").show();
        }else if (all=="付惠吧") {
            editFuHuiBa(i);
            strPaytype=replaceChat(strPaytype,11,1);
            $("#editFuHuiBa").show();
        }else if (all=="中国农行") {
            editabc(i);
            $("#editabcbType").trigger("change");
            strPaytype=replaceChat(strPaytype,14,1);
            $("#editabc").show();
        }else if (all=="轻松付") {
            editqingsongfu(i);
            $("#editqsftype").trigger("change");
            strPaytype=replaceChat(strPaytype,15,1);
            $("#editqsf").show();
        }else if (all=="汇银通POS") {
            editHuiYinTong(i);
            $("#edithuiYinTongType").trigger("change");
            strPaytype=replaceChat(strPaytype,18,1);
            $("#editHuiYinTong").show();
        }else if (all=="交通银行") {
            editbocom(i);
            $("#editbocomType").trigger("change");
            strPaytype=replaceChat(strPaytype,20,1);
            $("#editbocom").show();
        }else if (all=="拉卡拉") {
            editlaKaLa(i);
            $("#editlaKaLaType").trigger("change");
            strPaytype=replaceChat(strPaytype,21,1);
            $("#editlaKaLa").show();
        }else if (all=="邮政") {
            editpsbc(i);
            $("#editpsbcType").trigger("change");
            strPaytype=replaceChat(strPaytype,22,1);
            $("#editpsbc").show();
        }else if (all=="扫呗") {
            editsaobei(i);
            $("#editsaobeiType").trigger("change");
            strPaytype=replaceChat(strPaytype,23,1);
            $("#editsaobei").show();
        }else if (all=="嗨客") {
            edithaike(i);
            $("#edithaikeType").trigger("change");
            strPaytype=replaceChat(strPaytype,24,1);
            $("#edithaike").show();
        }else if (all=="富友") {
            editfuyou(i);
            $("#editfuyouType").trigger("change");
            strPaytype=replaceChat(strPaytype,25,1);
            $("#editfuyou").show();
        }else if (all=="进钱吧") {
            editlongzhimeng(i);
            $("#editlongzhimengType").trigger("change");
            strPaytype=replaceChat(strPaytype,26,1);
            $("#editlongzhimeng").show();
        }else if (all=="支付宝中小学一脸通") {
            editalischool(i);
            $("#editalischoolType").trigger("change");
            strPaytype=replaceChat(strPaytype,27,1);
            $("#editalischool").show();
        }else if (all=="中山通") {
            editzhongshantong(i);
            $("#editzhongshantongType").trigger("change");
            strPaytype=replaceChat(strPaytype,28,1);
            $("#editzhongshantong").show();
        }else if (all=="招行一网通") {
            editzhaohangyiwangtong(i);
            $("#editzhaohangyiwangtongType").trigger("change");
            strPaytype=replaceChat(strPaytype,29,1);
            $("#editzhaohangyiwangtong").show();
        }else if (all=="衢州一码付") {
            editquzhouyimafu(i);
            $("#editquzhouyimafuType").trigger("change");
            strPaytype=replaceChat(strPaytype,30,1);
            $("#editquzhouyimafu").show();
        }else if (all=="建行生活") {
            editjianhangshenghuo(i);
            $("#editjianhangshenghuoType").trigger("change");
            strPaytype=replaceChat(strPaytype,29,1);
            $("#editjianhangshenghuo").show();
        }else if (all=="中信银行") {
             editccbpay(i);
             strPaytype="000000000000000000000000000000000";
             $("#editccbpayType").trigger("change");
             strPaytype=replaceChat(strPaytype,32,1);
             $("#editccbpay").show();
         }else if (all=="银盛") {
          edityinsheng(i);
          strPaytype="0000000000000000000000000000000000";
          $("#edityinshengType").trigger("change");
          strPaytype=replaceChat(strPaytype,33,1);
          $("#edityinsheng").show();
         }else if (all=="兰州银行") {
            editlanzhou(i);
            strPaytype="0000000000000000000000000000000000000";
            $("#editlanzhouType").trigger("change");
            strPaytype=replaceChat(strPaytype,36,1);
            $("#editlanzhou").show();
        }else if (all=="农行缴费") {
            editnonghangjf(i);
            strPaytype="0000000000000000000000000000000000000";
            $("#editnonghangjfType").trigger("change");
            strPaytype=replaceChat(strPaytype,37,1);
            $("#editnonghangjf").show();
        }
    }
    $("#editpayChannel").val(strPaytype);
});